var path=require('path');
var webpack=require('webpack');
var HtmlwebpackPlugin=require('html-webpack-plugin');
var debug=process.env.NODE_ENV !=="production";
var ROOT_PATH=path.resolve(__dirname);
var APP_PATH=path.resolve(ROOT_PATH,'./src');
var BUILD_PATH=path.resolve(ROOT_PATH,'./__build');
var TEM_PATH=path.resolve(ROOT_PATH,'./templates');


var ExtractTextPlugin = require('extract-text-webpack-plugin');

// multiple extract instances
var extractCSS = new ExtractTextPlugin('style/[name].css');
var extractLESS = new ExtractTextPlugin('style/[name].less');

module.exports={
	entry: [
		'webpack-dev-server/client?http://localhost:8080', // WebpackDevServer host and port
		'webpack/hot/only-dev-server',
		'./src/Redux.js' // Your appʼs entry point
	],
	output:{
		path:'__build',
		filename:'bundle.js',
		 publicPath: '/'
	},
	resolve:{
		root: [process.cwd() + '/src', process.cwd() + '/node_modules'],
		 extensions: ['', '.js', '.css', '.scss', '.ejs', '.png', '.jpg']
	},
	devtool:'eval-source-map',
	devServer:{
		historyApiFallBack:'true',
		hot:true,
		inline:true,
		progress:true
	},
	 module: {
	    loaders: [
	      {
	        test: /\.js$/,
	        loaders: ['babel'],

	      },
	      {
	        test: /\.jsx?$/,
	        loaders: ['babel-loader'],
	        include: APP_PATH,
	      },
	      {
	      	test: /(\.css|\.scss)$/i, 
	      	loader: extractCSS.extract(['css','sass']),

	      },
 		{test: /\.(jpe?g|png|gif)$/i, loaders: ['url-loader?limit=10000&name=images/[name].[ext]']},
	    ]
	},
	jshint:{
		"esnext":true
	},
	plugins:[
		
      new webpack.NoErrorsPlugin(),
      new webpack.HotModuleReplacementPlugin(),
      extractCSS,
      extractLESS
	]
}








